/****************************************************************************
 *
 * Copyright (C) 2003-2008 Los Alamos National Security, LLC
 *                         Packet Analytics Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License Version 2 as
 * published by the Free Software Foundation.  You may not use, modify or
 * distribute this program under any other version of the GNU General
 * Public License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 ****************************************************************************/
package nfse;

import java.util.*;

/*******************************************************************************
 * 
 * Simple class for storing information about a data file indexed by Net/FSE.
 * 
 * 
 * @author
 * 
 * This code is the property of Los Alamos National Laboratory and the
 * University of California, Copyright 2005
 */
public class DataInfo {
   
	/***************************************************************************
     * Month of the data file (1-12)
     */
    private int month = -1;

    /***************************************************************************
     * Day of month of the data file (1-31)
     */
    private int day = -1;

    /***************************************************************************
     * Year of the data file (YYYY)
     */
    private int year = -1;

    /***************************************************************************
     * Monotonically increasing iteration of files in this day (1-n)
     */
    private int run = -1;

    /***************************************************************************
     * The full path of the file being indexed
     */
    private String dataPath = "";

    /***************************************************************************
     * Unix time in seconds for the earliest starting record in the file
     */
    private long minTime = -1;

    /***************************************************************************
     * Unix time in seconds for the latest starting record in the file
     */
    private long maxTime = -1;

    /***************************************************************************
     * Sensor that generated the data
     */
    private int sensor = -1;

    
    /***************************************************************************
     * Records in the file
     */
    private long numRecords = -1;

    /***************************************************************************
     * File size in bytes
     */
    private long numBytes = -1;

    /***************************************************************************
     * 
     * Default constructor
     * 
     */
    public DataInfo() {
    }

    /***************************************************************************
     * 
     * @return A textual representation of the object for display
     * 
     */
    public String toString() {
        String temp = "";
        temp += getSensor() + ": " + getMonth() + "-" + getDay() + "-" + getYear() + "." + getRun() + ", " + getDataPath();

        GregorianCalendar c1 = new GregorianCalendar();
        c1.setTimeInMillis(getMinTime() * 1000);
        java.util.Date startDate = c1.getTime();
        c1.setTimeInMillis(getMaxTime() * 1000);
        java.util.Date stopDate = c1.getTime();
        temp += " " + startDate.toString() + "-" + stopDate.toString();
            temp += " static ";
        if (getNumBytes() > 0) {
            temp += getNumBytes() + " bytes";
        }
        if (getNumRecords() > 0) {
            if (getNumBytes() > 0)
                temp += ", ";
            temp += getNumRecords() + " reocrds";
        }
        return temp;
    }

	/**
	 * @param month the month to set
	 */
	public void setMonth(int month) {
		this.month = month;
	}

	/**
	 * @return the month
	 */
	public int getMonth() {
		return month;
	}

	/**
	 * @param day the day to set
	 */
	public void setDay(int day) {
		this.day = day;
	}

	/**
	 * @return the day
	 */
	public int getDay() {
		return day;
	}

	/**
	 * @param year the year to set
	 */
	public void setYear(int year) {
		this.year = year;
	}

	/**
	 * @return the year
	 */
	public int getYear() {
		return year;
	}

	/**
	 * @param run the run to set
	 */
	public void setRun(int run) {
		this.run = run;
	}

	/**
	 * @return the run
	 */
	public int getRun() {
		return run;
	}

	/**
	 * @param dataPath the dataPath to set
	 */
	public void setDataPath(String dataPath) {
		this.dataPath = dataPath;
	}

	/**
	 * @return the dataPath
	 */
	public String getDataPath() {
		return dataPath;
	}

	/**
	 * @param minTime the minTime to set
	 */
	public void setMinTime(long minTime) {
		this.minTime = minTime;
	}

	/**
	 * @return the minTime
	 */
	public long getMinTime() {
		return minTime;
	}

	/**
	 * @param maxTime the maxTime to set
	 */
	public void setMaxTime(long maxTime) {
		this.maxTime = maxTime;
	}

	/**
	 * @return the maxTime
	 */
	public long getMaxTime() {
		return maxTime;
	}

	/**
	 * @param sensor the sensor to set
	 */
	public void setSensor(int sensor) {
		this.sensor = sensor;
	}

	/**
	 * @return the sensor
	 */
	public int getSensor() {
		return sensor;
	}

	/**
	 * @param numRecords the numRecords to set
	 */
	public void setNumRecords(long numRecords) {
		this.numRecords = numRecords;
	}

	/**
	 * @return the numRecords
	 */
	public long getNumRecords() {
		return numRecords;
	}

	/**
	 * @param numBytes the numBytes to set
	 */
	public void setNumBytes(long numBytes) {
		this.numBytes = numBytes;
	}

	/**
	 * @return the numBytes
	 */
	public long getNumBytes() {
		return numBytes;
	}
}